package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.HuifuBean;
import com.lwj.liwanjia.impl.HuifuView;
import com.lwj.liwanjia.model.SendHuifuModel;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/12/18.
 */

public class SendHuifuPresenter {
    private SendHuifuModel sendHuifuModel;
    private HuifuView huifuView;

    public SendHuifuPresenter(HuifuView huifuView) {
        this.huifuView = huifuView;
        sendHuifuModel = new SendHuifuModel();
    }

    public void sendHuifu(Map<String, Object> map) {
        if (huifuView != null) {
            sendHuifuModel.sedHuifu(map, new Subscriber<HuifuBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    huifuView.showError((Exception) e);
                }

                @Override
                public void onNext(HuifuBean huifuBean) {
                    huifuView.sendHuifu(huifuBean);
                }
            });
        }
    }
}
